package com.seventh.parkingrent.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.seventh.parkingrent.domain.ParkingSpace;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.seventh.parkingrent.domain.ParkingSpaceAudit;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 车位信息表 Mapper 接口
 * </p>
 *
 * @author Lucas
 * @since 2021-08-24
 */
public interface ParkingSpaceMapper extends BaseMapper<ParkingSpace>{

@Select("select * from pr_parking_space where parking_space_id=#{parkingSpaceId}")
    ParkingSpace findStatus(int parkingSpaceId);


@Select("select * from pr_parking_space where user_id=#{userId}")
IPage<ParkingSpace> findAll(IPage<ParkingSpace> page,@Param("userId") int userId);


@Update("update pr_parking_space set state=#{state} where parking_space_id=#{parkingSpaceId} ")
    Integer changeState(@Param("state") String state, @Param("parkingSpaceId")int parkingSpaceId);

@Select("select * from pr_parking_space where parking_space_no=#{parkingSpaceNo}")
        List<ParkingSpace> checkNo(String parkingSpaceNo);
}
